package com.hl.mapper;

import com.hl.pojo.Coursefavorites;
import com.hl.pojo.Mycoursefavorites;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface CourseFavoriteMapper {
    @Select("select * from mycoursefavorites where user_id = #{userId} and is_paid = 0;")
    public List<Mycoursefavorites> getCourseFavoriteNoPaid(Integer id);
    @Select("select * from mycoursefavorites where user_id = #{userId} and is_paid = 1;")
    public List<Mycoursefavorites> getCourseFavoriteIsPaid(Integer id);
//    @Select("select * from mycoursefavorites")
    public List<Mycoursefavorites> SelectCourseFavoriteListAll();

    @Update("UPDATE mycoursefavorites SET is_paid = #{isPaid} WHERE favorite_id = #{favoriteId}")
    public int UpdateCourseFavoriteList(Mycoursefavorites mycoursefavorites);

}
